<template>
  <div> 
      <div >评论{{count}}</div>
      <comment-template title="开始评论"></comment-template> 
      <article-content v-on:msg-child-change="handleChild"></article-content>
  </div>
</template>

<script>
import commentTemplate from '@/components/CommentTemplate.vue'
import articleContent from '@/components/ArticleContent.vue'

 export default {
   data () {
     return {
        count: 0
     }
   },
   components:{
     commentTemplate,
     articleContent
    },
    created(){
        console.log('created...');
        this.$on('submit', this.updateComnentCount); 
    },
    mounted() {
      console.log('mounted...');
      
    },

   methods: {
      updateComnentCount(data){
        console.log('mycomment listen ' +data);
        this.count  = data;
      },
      handleChild(msg){
        console.log('listen child msg: ' +msg);
      }
   }
 }
</script>

<style scoped>

 
</style>
